﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using Tools;

namespace Dialogs
{
    public class BaseForm : Form
    {
        protected DbContext dbContext;

        public BaseForm()
        {
        }

        public BaseForm(DbContext dbContext)
            : base()
        {
            this.dbContext = dbContext;
        }

        public DbContext DbContext
        {
            get
            {
                return dbContext;
            }
            set
            {
                dbContext = value;
            }
        }

        protected virtual void Write()
        {
        }

        public virtual string Command
        {
            get
            {
                Control[] controls = this.Controls.Find("tbCommand", true);

                if (controls.Length == 1)
                {
                    TextBox tb = (TextBox)controls[0];
                    return tb.Text;
                }
                else
                {
                    return string.Empty;
                }
            }
        }

    }
}
